<template>
    <div class="edit">
        你的名字: {{userName}}
        你的ID: {{userId}}
        <cube-input  @focus="focus"  placeholder="输入消息" v-model="txt"></cube-input>
        <cube-button @click="sendTxt" :active="true">发送消息</cube-button>
    </div>
</template>

<script>
    export default {
        methods:{
            focus(){
                this.$emit('focus')
            },
            sendTxt(){
                this.$emit('sendTxt',this.txt)
                this.txt=''
            }
        },
        updated(){
           this.$emit('scrollToEnd')
        },
        data(){
           return {
               txt:null
           }
        },
        props:{
            userName:{
                type:String
            },
            userId:{
                type: Number
            }
        }
    }
</script>

<style scoped>

</style>